from django import forms

from captcha.fields import CaptchaField
from .models import Comment


class CommentForm(forms.ModelForm):
    captcha = CaptchaField(error_messages={'invalid': '验证码错误!', 'required': '验证码不能为空！'})

    class Meta:
        model = Comment
        fields = ['name', 'email', 'comment', 'captcha']

